import ajax, { ListResult, toOptions } from '../ajax';
import { computed, ref } from 'vue';

export function getKnowledgeGraph() {
  return ajax.get<any>('/Tags/Subjects/10/KnowledgePoints/Graph');
}

export function getKnowledge(id: number) {
  return ajax.get<any>(`/Tags/KnowledgePoints/${id}`);
}

export function updateKnowledge(data:any) {
  if(data.pointId) {
    return ajax.put<any>('/Tags/KnowledgePoints', data);
  } else {
    return ajax.post<any>('/Tags/KnowledgePoints', data);
  }
}

export function deleteKnowledge(data:any) {
  if(data.id) {
    return ajax.put<any>('/Tags/KnowledgePoints/Actions/Delete', data);
  }

  return false;
}

export function createKnowledgeRelations(data:any) {
  return ajax.post<any>('/Tags/KnowledgePoints/Relations', data);
}


export function moveKnowledge(data:any) {
  return ajax.post<any>('/Tags/KnowledgePoints/Tree/Actions/Move', data);
}
